import { ref, computed } from 'vue'
import { $t } from '@vben/locales'


export const useCodeName = () => {
  // 全局状态，确保所有地方使用同一个实例
  const isVoiceCode = ref(false)
  const codeBtnName = computed(() => {
    return isVoiceCode.value ? $t('login.voiceCode') : $t('login.verificationCode')
  })
  const codeInputPlaceholder = computed(() => {
    return isVoiceCode.value ? $t('common.inputPhTxt', [$t('login.voiceCode')]) : $t('common.inputPhTxt', [$t('login.verificationCode')])
  })
  
  return {
    isVoiceCode,
    codeBtnName,
    codeInputPlaceholder
  }
}
